package io.renren.modules.pay_account.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.pay_account.entity.V9PayAccountEntity;
import io.renren.modules.pay_account.service.V9PayAccountService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 充值记录
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-09-21 15:30:21
 */
@RestController
@RequestMapping("pay_account/v9payaccount")
public class V9PayAccountController {
    @Autowired
    private V9PayAccountService v9PayAccountService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("pay_account:v9payaccount:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = v9PayAccountService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("pay_account:v9payaccount:info")
    public R info(@PathVariable("id") Integer id){
		V9PayAccountEntity v9PayAccount = v9PayAccountService.getById(id);

        return R.ok().put("v9PayAccount", v9PayAccount);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("pay_account:v9payaccount:save")
    public R save(@RequestBody V9PayAccountEntity v9PayAccount){
		v9PayAccountService.save(v9PayAccount);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("pay_account:v9payaccount:update")
    public R update(@RequestBody V9PayAccountEntity v9PayAccount){
		v9PayAccountService.updateById(v9PayAccount);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("pay_account:v9payaccount:delete")
    public R delete(@RequestBody Integer[] ids){
		v9PayAccountService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
